package com.dingreading.cloud.soms.util;


import com.dingreading.cloud.common.util.KitUtil;
import com.dingreading.cloud.soms.entity.FollowType;
import com.dingreading.cloud.soms.entity.MemberFollow;

import java.util.Date;

public class FollowUtil {

    /**
     * 创建跟进类型
     */
    public static FollowType newFollowType(
            FollowType data, String corpUid, String storeUid, String staffUid, String staffName, String name, int handStatus
    ) {
        if (null == data) {
            data = new FollowType();
            data.setCorpUid(corpUid);
            data.setStoreUid(storeUid);
            data.setUid(KitUtil.getUuid());
            data.setAddStaffUid(staffUid);
            data.setAddStaffName(staffName);
            data.setEnabled(1);
            data.setHandStatus(handStatus);
        }
        data.setName(name);
        data.setLastStaffUid(staffUid);
        data.setLastStaffName(staffName);
        return data;
    }

    /**
     * 系统，创建会员跟进记录
     */
    public static MemberFollow newFollow(
            String corpUid, String storeUid, String storeName, String staffUid, String staffName, String memberUid,
            String memberName, String followUid, String followType, String content, String keyword, Date followTime
    ) {
        MemberFollow data = new MemberFollow();
        data.setUid(KitUtil.getUuid());
        data.setCorpUid(corpUid);
        data.setStoreUid(storeUid);
        data.setStoreName(storeName);
        data.setAddStaffUid(staffUid);
        data.setAddStaffName(staffName);
        data.setMemberUid(memberUid);
        data.setMemberName(memberName);
        data.setFollowTypeUid(followUid);
        data.setFollowType(followType);
        data.setContent(content);
        data.setKeyword(keyword);
        data.setFollowStaffUid(staffUid);
        data.setFollowStaffName(staffName);
        data.setSource(1);
        data.setFollowTime(followTime);
        return data;
    }

    public static MemberFollow newFollow(
            String lastFollowUid, String corpUid, String storeUid, String storeName, String staffUid, String staffName, String memberUid,
            String memberName, String followUid, String followType, String content, String keyword, Date followTime
    ) {
        MemberFollow follow = newFollow(corpUid, storeUid, storeName, staffUid, staffName, memberUid, memberName,
                followUid, followType, content, keyword, followTime);
        follow.setUid(lastFollowUid);
        return follow;
    }

    /**
     * 手动，创建会员跟进记录
     */
    public static MemberFollow newFollowHand(
            MemberFollow data,
            String corpUid, String storeUid, String storeName, String staffUid, String staffName, String memberUid,
            String memberName, String followUid, String followType, String content, String keyword, Date followTime,
            String followStaffUid, String followStaffName
    ) {
        if (null == data) {
            data = new MemberFollow();
            data.setCorpUid(corpUid);
            data.setStoreUid(storeUid);
            data.setStoreName(storeName);
            data.setMemberUid(memberUid);
            data.setMemberName(memberName);
            data.setAddStaffUid(staffUid);
            data.setAddStaffName(staffName);
            data.setUid(KitUtil.getUuid());
            data.setSource(2);
        }
        data.setFollowTypeUid(followUid);
        data.setFollowType(followType);
        data.setContent(content);
        data.setKeyword(keyword);
        data.setFollowStaffUid(followStaffUid);
        data.setFollowStaffName(followStaffName);
        data.setFollowTime(followTime);
        data.setLastStaffUid(staffUid);
        data.setLastStaffName(staffName);
        return data;
    }
}
